package com.study.spring.aop;

import org.aspectj.lang.annotation.*;

@Aspect
public class AnnationTransactionAop {

    @Pointcut("execution(* com.study.spring.aop.*Dao.*(..))")
    public void dmlTransaction(){}

    @Before("dmlTransaction()")
    public void beforeOpenTransaction() {
        System.out.println("注解-开启事务");
    }

    @AfterReturning("dmlTransaction()")
    public void asfterCommitTransaction() {
        System.out.println("注解-关闭事务");
    }

    @AfterThrowing("dmlTransaction()")
    public void throwRollbackTranstacion() {
        System.out.println("注解-回滚事务");
    }
}
